package kr.hkit.powerjava.chapter22.work3;

import java.util.ArrayList;
import java.util.Collections;

public class Programming_5_2 {
	public static void main(String[] args) {
		ArrayList<Double> list= new ArrayList<Double>();
		list.add(1.2); list.add(6.2);
		list.add(7.2); list.add(8.2);
		list.add(9.2); list.add(9.9); 
		list.add(2.2); list.add(3.2);
		list.add(4.2); list.add(5.2);
		
		Collections.sort(list);
		System.out.println(list);
		System.out.println(list.get(list.indexOf(Collections.max(list))));
		System.out.println(list.get(list.indexOf(Collections.min(list))));
		double total=0;
		for (int i = 0; i < list.size(); i++) {
			if(list.get(i)!=Collections.max(list) && list.get(i)!=Collections.min(list)){
				total=total+list.get(i);
			}
			
		}System.out.printf("%2.1f",total);
	}
}
